package com.jucai.pppeiyouclient.utils;

import android.content.Context;

/**
 * Created by UPC on 2017/4/13.
 */

public class LoginUtils {

    public static void saveMember_id(Context context, String member_id) {
        SharedPreferencesUtil.saveStringPreference(context, "LoginDatas", "member_id", member_id);
    }

    public static String getMember_id(Context context) {
        return SharedPreferencesUtil.getStringPreference(context, "LoginDatas", "member_id", "");
    }

    public static void saveMember_nickname(Context context, String member_nickname) {
        SharedPreferencesUtil.saveStringPreference(context, "LoginDatas", "member_nickname", member_nickname);
    }

    public static String getMember_nickname(Context context) {
        return SharedPreferencesUtil.getStringPreference(context, "LoginDatas", "member_nickname", "");
    }

    public static void saveMember_phone(Context context, String member_phone) {
        SharedPreferencesUtil.saveStringPreference(context, "LoginDatas", "member_phone", member_phone);
    }

    public static String getMember_phone(Context context) {
        return SharedPreferencesUtil.getStringPreference(context, "LoginDatas", "member_phone", "");
    }

    public static void saveMember_avatar(Context context, String member_avatar) {
        SharedPreferencesUtil.saveStringPreference(context, "LoginDatas", "member_avatar", member_avatar);
    }

    public static String getMember_avatar(Context context) {
        return SharedPreferencesUtil.getStringPreference(context, "LoginDatas", "member_avatar", "");
    }

    public static void saveToken(Context context, String token) {
        SharedPreferencesUtil.saveStringPreference(context, "LoginDatas", "token", token);
    }

    public static String getToken(Context context) {
        return SharedPreferencesUtil.getStringPreference(context, "LoginDatas", "token", "");
    }

    public static void saveRongyun_token(Context context, String rongyun_token) {
        SharedPreferencesUtil.saveStringPreference(context, "LoginDatas", "rongyun_token", rongyun_token);
    }

    public static void saveRongyun_id(Context context, String rongyun_id) {
        SharedPreferencesUtil.saveStringPreference(context, "LoginDatas", "rongyun_id", rongyun_id);
    }

    public static String getRongyun_token(Context context) {
        return SharedPreferencesUtil.getStringPreference(context, "LoginDatas", "rongyun_token", "");
    }

    public static String getRongyun_id(Context context) {
        return SharedPreferencesUtil.getStringPreference(context, "LoginDatas", "rongyun_id", "");
    }

    public static void saveOpenInstallChannel(Context context, String token) {
        SharedPreferencesUtil.saveStringPreference(context, "IMDatas", "openInstallChannel", token);
    }

    public static String getOpenInstallChannel(Context context) {
        return SharedPreferencesUtil.getStringPreference(context, "IMDatas", "openInstallChannel", "");
    }

    public static void saveOpenInstallId(Context context, String token) {
        SharedPreferencesUtil.saveStringPreference(context, "IMDatas", "openInstallId", token);
    }

    public static String getOpenInstallId(Context context) {
        return SharedPreferencesUtil.getStringPreference(context, "IMDatas", "openInstallId", "");
    }

    public static void clearLoginDatas(Context context) {
        saveMember_avatar(context, "");
        saveMember_id(context, "");
        saveMember_nickname(context, "");
        saveMember_phone(context, "");
        saveToken(context, "");
        saveRongyun_id(context, "");
        saveRongyun_token(context, "");
    }
}
